import org.apache.hadoop.hive.conf.HiveConf
import org.apache.hadoop.hive.metastore.HiveMetaStoreClient
import org.junit.Test

object Test2 {

  @Test
  def getDB(): Unit ={

  }

  def main(args: Array[String]): Unit = {

    System.setProperty("hadoop.home.dir", "C:\\hadoop")
    val hiveConf = new HiveConf
    //<name>hive.metastore.uris</name>
    //    <value>thrift://bdptest1:9083</value>
    hiveConf.set("hive.metastore.uris", "thrift://bdptest1:9083")
    //hiveConf.set("user","ro")
    //设置hiveMetaStore服务的地址
    val hiveMetaStoreClient = new HiveMetaStoreClient(hiveConf)
    //当前版本2.3.4与集群3.0版本不兼容，加入此设置
   // hiveMetaStoreClient.setMetaConf("hive.metastore.client.capability.check", "true");



    val tablesList = hiveMetaStoreClient.getAllTables("prod_bd")
    println(tablesList)


    hiveMetaStoreClient.close()
  }

}
